<%--
  Created by IntelliJ IDEA.
  User: zhangkeke
  Date: 2022/9/27
  Time: 14:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>展示所有用户</title>
</head>
<body>
<table >
    <tr>
        <td>编号</td>
        <td>姓名</td>
        <td>密码</td>
        <td>性别</td>
        <td>年龄</td>
        <td>地址</td>
        <td>QQ</td>
        <td>Email</td>
        <td colspan="2">操作</td>
    </tr>

    <c:forEach items="${pageBeanUtils.pageData}" var="user">  <%--//注意这里用的是.pageData--%>
        <tr>
            <td>${user.id}</td>
            <td>${user.username}</td>
            <td>${user.password}</td>
            <td>${user.gender}</td>
            <td>${user.age}</td>
            <td>${user.address}</td>
            <td>${user.qq}</td>
            <td>${user.email}</td>
            <td><a href="/delete?id=${user.id}">删除</a></td>
            <td><a href="/findUserById?id=${user.id}">修改</a></td>
        </tr>
    </c:forEach>
    <tr>
        <td colspan="6"><a href="/insertUser.jsp">添加数据</a></td>
        <a href="${pageContext.request.contextPath}/findAll?currentPage=1&pageSize=5">首页</a>
        <c:if test="${pageBeanUtils.currentPage>1}">
            <a href="${pageContext.request.contextPath}/findAll?currentPage=${pageBeanUtils.currentPage-1}&pageSize=5">上一页</a>
        </c:if>
        <%--
            下一页：
            当前页不是尾页
        --%>
        <c:if test="${pageBeanUtils.currentPage<pageBeanUtils.totalPage}">
            <a href="${pageContext.request.contextPath}/findAll?currentPage=${pageBeanUtils.currentPage+1}&pageSize=5">下一页</a>
        </c:if>
        <a href="${pageContext.request.contextPath}/findAll?currentPage=${pageBeanUtils.totalPage}&pageSize=5">尾页</a>
    </tr>
</table>


</body>
</html>
